package com.fulong.service.impl;

import com.fulong.common.utils.Constant;
import com.fulong.dao.UserBaiseInfoDao;
import com.fulong.entity.UserBaiseInfoEntity;
import com.fulong.service.UserBaiseInfoService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fulong.common.utils.PageUtils;
import com.fulong.common.utils.Query;
@Service("userBaiseInfoService")
public class UserBaiseInfoServiceImpl extends ServiceImpl<UserBaiseInfoDao, UserBaiseInfoEntity> implements UserBaiseInfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        int currentpage  = 1 ;
        //没有页面
        if(params.get("page")!=null) {
            currentpage = Integer.parseInt(params.get("page").toString());
            params.remove("page") ;
        }
        HashMap<String , Object> map = new HashMap<>();
        map.put(Constant.PAGE , String.valueOf(currentpage)) ;
        IPage<UserBaiseInfoEntity> page = this.page(
                new Query<UserBaiseInfoEntity>().getPage(params),
                new QueryWrapper<UserBaiseInfoEntity>()
        );
        return new PageUtils(page);
    }

    @Override
    public Map<String, Object> getapprover(Map<String, Object> params) {
//        List<UserBaiseInfoEntity> list = this.list(new QueryWrapper<UserBaiseInfoEntity>().allEq(params));
        String id = params.get("id").toString();
        return baseMapper.getApproverInfo(id);
    }
}